package mtn.bowen.yan.server.enums;

/**
 * @author <a href=mailto:yanbowen90@foxmail.com> bowen.yan </a>
 * @version 1.0
 * @description: TODO
 * @date 2021-11-04 11:57 AM
 */
public enum PollsSuggestEnum {

    /*** 点赞 */
    STAPLE_FOOD(1, true, "点赞"),
    /*** 拍砖 */
    NON_STAPLE_FOOD(2, false, "拍砖"),
    /*** 未知分类 */
    UNKNOWN(99, true, "未知分类"),
    ;

    PollsSuggestEnum(int code, boolean state, String msg) {
        this.code = code;
        this.state = state;
        this.msg = msg;
    }

    public static PollsSuggestEnum getPollsSuggest(String msg) {
        for (PollsSuggestEnum value : values()) {
            if (value.getMsg().equals(msg)) {
                return value;
            }
        }
        return UNKNOWN;
    }

    public static PollsSuggestEnum getPollsSuggest(Integer code) {
        for (PollsSuggestEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return UNKNOWN;
    }

    private Integer code;
    private String msg;
    private Boolean state;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Boolean getState() {
        return state;
    }

    public void setState(Boolean state) {
        this.state = state;
    }
}
